package com.reggie.service.model.bo;

import com.reggie.acl.dataobject.Setmeal;
import com.reggie.acl.dataobject.SetmealDish;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.beans.BeanUtils;

import java.util.Collections;
import java.util.List;
import java.util.Optional;

/**
 * 套餐 数据传输类
 *
 * @author yth
 * @since 2023/2/6 1:18
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class SetmealBO extends Setmeal {

    public SetmealBO() {
    }

    public SetmealBO(Setmeal setmeal) {
        Optional.ofNullable(setmeal)
                .ifPresent(e -> BeanUtils.copyProperties(e, this));
        this.setmealDishes = Collections.emptyList();
    }

    /**
     * 套餐中包含的菜品集合
     */
    private List<SetmealDish> setmealDishes;

    /**
     * 套餐分类
     */
    private String categoryName;

    /**
     * 套餐份数
     */
    private Integer copies;

}
